package com.GlobalPaint.app.bean;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;

import com.GlobalPaint.app.R;
import com.GlobalPaint.app.utils.CommUtility;

import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;


public class PhotoViewActivity extends FragmentActivity {
    PhotoViewAttacher mAttacher;
    PhotoView mImageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_photo_view);
        String imageUrl = getIntent().getStringExtra("photoView");
        mImageView = (PhotoView) findViewById(R.id.photoView);
        mImageView.setImageURI(CommUtility.getImageContentUri(this, imageUrl));
        // Attach a PhotoViewAttacher, which takes care of all of the zooming
        // functionality.
        mAttacher = new PhotoViewAttacher(mImageView);
        mAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
            @Override
            public void onPhotoTap(View view, float x, float y) {
                finish();
            }
        });
    }
}
